
import com.zaxxer.hikari.HikariDataSource;

import java.sql.Connection;
import java.sql.SQLException;

public class Hello {
    public static void main(String[] args) throws SQLException {

        HikariDataSource dataSource = new HikariDataSource();
        dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
        dataSource.setJdbcUrl("jdbc:mysql://localhost:3306/jdbc");
        dataSource.setUsername("root");
        dataSource.setPassword("080472");
        dataSource.setMaximumPoolSize(10);
        dataSource.setMinimumIdle(5);
        dataSource.setConnectionTimeout(3000);
        dataSource.setIdleTimeout(3000);


        try{
            Connection connection = dataSource.getConnection();
            if (connection != null){
                System.out.println("Connection established");
            }else{
                System.out.println("Connection failed");
            }
        }catch (SQLException e){
            throw new RuntimeException();
        }

    }
}
